package ch.uzh.ifi.seal.ssqa.popup.actions;

import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;

import ch.uzh.ifi.seal.ssqa.importer.cqquery.CQQueryImporter;

public class CQQuerytestAction implements IObjectActionDelegate {
	
	Shell shell;

	@Override
	public void run(IAction action) {
		
		CQQueryImporter importer = new CQQueryImporter();
		
		//importer.getResultFromSQLQuery("select distinct T1.dbid,T1.id,T1.submit_date,T6.product,T1.fixed_in_ka,T1.headline,T2.misc_info,T2.fullname,T1.trk_planned_work_impl,T1.trk_actual_work_impl,T1.trk_start_date_impl,T1.trk_end_date_impl,T7.name from cr T1,product T6,users T2,statedef T7,platform T8,assembly_group T9 where T1.product = T6.dbid and T1.owner = T2.dbid and T1.state = T7.id and T1.platform = T8.dbid and T1.assembly_group = T9.dbid and (T1.dbid <> 0 and ((T8.platform = 'PF91' and T9.assembly_group = 'SW' and T1.bug_type = 'Defect'))) order by T2.misc_info ASC,T2.fullname ASC");
		importer.getResultFromClearCase();
		MessageDialog.open(MessageDialog.INFORMATION, this.shell, "Test", "Test", SWT.None);

	}

	@Override
	public void selectionChanged(IAction action, ISelection selection) {
		// TODO Auto-generated method stub

	}

	@Override
	public void setActivePart(IAction action, IWorkbenchPart targetPart) {
		this.shell = targetPart.getSite().getShell();
	}

}
